package com.business.leaf.core.segment.domain.valobj;

import com.business.leaf.core.segment.domain.entity.SegmentBuffer;
import lombok.Builder;
import lombok.Data;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

/**
 * @ClassName Segment
 * @Description 具体的缓存内容
 * @Author lgh
 * @Date 2020-04-08 16:19
 */
@Data
public class Segment {

    private String bizTag;

    private AtomicLong maxId;

    private AtomicInteger step;

    private String desc;

    SegmentBuffer segmentBuffer;

    private String tag;

    private AtomicLong value;

    public Segment(SegmentBuffer segmentBuffer, String tag) {
        this.segmentBuffer = segmentBuffer;
        this.tag = tag;
        this.maxId=(new AtomicLong(0));
        this.step=(new AtomicInteger(0));
        this.value=(new AtomicLong(0));
    }

    @Override
    public String toString() {
        return "Segment{" +
                "bizTag='" + bizTag + '\'' +
                ", maxId=" + maxId +
                ", step=" + step +
                ", desc='" + desc + '\'' +
                ", tag='" + tag + '\'' +
                ", value=" + value +
                '}';
    }
}
